package com.share.pattern.observer.v4;

import java.util.ArrayList;
import java.util.List;

abstract class Subject {
	private List<Observer> observers = new ArrayList<Observer>();

	// add observer
	public void Attach(Observer observer) {
		observers.add(observer);
	}

	// delete observer
	public void Detach(Observer observer) {
		observers.remove(observer);
	}

	// notify
	public void Notify() {
		for (Observer o : observers) {
			o.Update();
		}
	}
}
